/*
 * Copyright 2018 JDCLOUD.COM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http:#www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * 密钥管理服务
 * 基于硬件保护密钥的安全数据托管服务
 *
 * OpenAPI spec version: v1
 * Contact: 
 *
 * NOTE: This class is auto generated by the jdcloud code generator program.
 */


using JDCloudSDK.Core.Auth;
using JDCloudSDK.Core.Client;
using JDCloudSDK.Core.Http;
using JDCloudSDK.Kms.Apis;
using JDCloudSDK.Kms.Model;
using System;
using System.Collections.Generic;
using System.Text;
#if NET40||NET35
#else
using System.Threading.Tasks;
#endif

namespace JDCloudSDK.Kms.Client
{
    /// <summary>
    ///  密钥管理服务
    ///  基于硬件保护密钥的安全数据托管服务
    ///  Kms Api 客户端
    ///</summary>
    public class KmsClient : JdcloudClient
    {

        /// <summary>
        ///  默认私有构造函数
        /// </summary>
        private KmsClient()
        {

        }

        /// <summary>
        /// 默认构造函数
        /// </summary>
        /// <param name="credentialsProvider">认证信息</param>
        /// <param name="httpRequestConfig">http 客户端配置信息</param>
        /// <param name="environment">sdk 环境配置信息</param>
        public KmsClient(CredentialsProvider credentialsProvider, HttpRequestConfig httpRequestConfig,SDKEnvironment environment)
        {
            this.httpRequestConfig = httpRequestConfig;
            this.credentialsProvider = credentialsProvider;
            this.environment = environment;
        }

        /// <summary>
        /// 默认构造函数
        /// </summary>
        /// <param name="httpRequestConfig">http 客户端配置信息</param>
        /// <param name="credentialsProvider">认证信息</param>
        public KmsClient(CredentialsProvider credentialsProvider,HttpRequestConfig httpRequestConfig)
        {
            this.httpRequestConfig = httpRequestConfig;
            this.credentialsProvider = credentialsProvider;
        }

        /// <summary>
        /// 默认构造函数，
        /// 注意如果使用此方法 httpRequestConfig 使用的http 请求 schema 为Https
        /// </summary>
        /// <param name="credentialsProvider">认证信息</param>
        public KmsClient(CredentialsProvider credentialsProvider)
        {
            this.credentialsProvider = credentialsProvider;
        }

        /// <summary>
        ///  版本号 1.2.3
        ///</summary>
        public const string ClientVersion = "1.2.3";

        private const string apiVersion = "v1";
        private const string userAgentPrefix = "JdcloudSdkDotNet";
        private const string defaultEndpoint = "kms.jdcloud-api.com";
        private const string serviceName = "kms";
        private const string userAgent = userAgentPrefix + "/" + ClientVersion + " " + serviceName + "/" + apiVersion;


        private SDKEnvironment environment = new SDKEnvironment(defaultEndpoint);
        private CredentialsProvider credentialsProvider;
        private HttpRequestConfig httpRequestConfig;

        /// <summary>
        ///  获取证书信息
        ///</summary>
        public override CredentialsProvider CredentialsProvider   { get { return credentialsProvider; } }

        /// <summary>
        ///  获取http 客户端配置信息
        ///</summary>
        public override HttpRequestConfig HttpRequestConfig { get { return httpRequestConfig; } }

        /// <summary>
        ///  获取sdk环境配置信息
        ///</summary>
        public override SDKEnvironment SDKEnvironment { get { return environment; } }

        /// <summary>
        ///  获取用户自定义浏览器识别字符串
        ///</summary>
        public override string UserAgent { get { return userAgent; } }

        /// <summary>
        ///  获取服务名称
        ///</summary>
        public override string ServiceName { get { return serviceName; } }

        /// <summary>
        ///  获取版本号
        ///</summary>
        public override string Version { get { return apiVersion; } }



#if NET40||NET35
        /// <summary>
        ///  获取非对称密钥的公钥
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public GetPublicKeyResponse GetPublicKey(GetPublicKeyRequest request) {
            return  new GetPublicKeyExecutor().Client(this).Execute<GetPublicKeyResponse, GetPublicKeyResult, GetPublicKeyRequest>(request);
        }
#else
        /// <summary>
        ///  获取非对称密钥的公钥
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<GetPublicKeyResponse> GetPublicKey(GetPublicKeyRequest request) {
            return await new GetPublicKeyExecutor().Client(this).Execute<GetPublicKeyResponse, GetPublicKeyResult, GetPublicKeyRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  获取密钥列表
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DescribeKeyListResponse DescribeKeyList(DescribeKeyListRequest request) {
            return  new DescribeKeyListExecutor().Client(this).Execute<DescribeKeyListResponse, DescribeKeyListResult, DescribeKeyListRequest>(request);
        }
#else
        /// <summary>
        ///  获取密钥列表
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DescribeKeyListResponse> DescribeKeyList(DescribeKeyListRequest request) {
            return await new DescribeKeyListExecutor().Client(this).Execute<DescribeKeyListResponse, DescribeKeyListResult, DescribeKeyListRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  修改机密指定版本配置
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public UpdateSecretVersionResponse UpdateSecretVersion(UpdateSecretVersionRequest request) {
            return  new UpdateSecretVersionExecutor().Client(this).Execute<UpdateSecretVersionResponse, UpdateSecretVersionResult, UpdateSecretVersionRequest>(request);
        }
#else
        /// <summary>
        ///  修改机密指定版本配置
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<UpdateSecretVersionResponse> UpdateSecretVersion(UpdateSecretVersionRequest request) {
            return await new UpdateSecretVersionExecutor().Client(this).Execute<UpdateSecretVersionResponse, UpdateSecretVersionResult, UpdateSecretVersionRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  从KMS中获取一对数据密钥的明文/密文
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public GenerateDataKeyResponse GenerateDataKey(GenerateDataKeyRequest request) {
            return  new GenerateDataKeyExecutor().Client(this).Execute<GenerateDataKeyResponse, GenerateDataKeyResult, GenerateDataKeyRequest>(request);
        }
#else
        /// <summary>
        ///  从KMS中获取一对数据密钥的明文/密文
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<GenerateDataKeyResponse> GenerateDataKey(GenerateDataKeyRequest request) {
            return await new GenerateDataKeyExecutor().Client(this).Execute<GenerateDataKeyResponse, GenerateDataKeyResult, GenerateDataKeyRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  启用指定版本密钥
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public EnableKeyVersionResponse EnableKeyVersion(EnableKeyVersionRequest request) {
            return  new EnableKeyVersionExecutor().Client(this).Execute<EnableKeyVersionResponse, EnableKeyVersionResult, EnableKeyVersionRequest>(request);
        }
#else
        /// <summary>
        ///  启用指定版本密钥
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<EnableKeyVersionResponse> EnableKeyVersion(EnableKeyVersionRequest request) {
            return await new EnableKeyVersionExecutor().Client(this).Execute<EnableKeyVersionResponse, EnableKeyVersionResult, EnableKeyVersionRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  创建机密
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public CreateSecretResponse CreateSecret(CreateSecretRequest request) {
            return  new CreateSecretExecutor().Client(this).Execute<CreateSecretResponse, CreateSecretResult, CreateSecretRequest>(request);
        }
#else
        /// <summary>
        ///  创建机密
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<CreateSecretResponse> CreateSecret(CreateSecretRequest request) {
            return await new CreateSecretExecutor().Client(this).Execute<CreateSecretResponse, CreateSecretResult, CreateSecretRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  使用密钥对数据进行加密，针对非对称密钥：使用公钥进行加密，仅支持RSA_PKCS1_PADDING填充方式，最大加密数据长度为245字节
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public EncryptResponse Encrypt(EncryptRequest request) {
            return  new EncryptExecutor().Client(this).Execute<EncryptResponse, EncryptResult, EncryptRequest>(request);
        }
#else
        /// <summary>
        ///  使用密钥对数据进行加密，针对非对称密钥：使用公钥进行加密，仅支持RSA_PKCS1_PADDING填充方式，最大加密数据长度为245字节
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<EncryptResponse> Encrypt(EncryptRequest request) {
            return await new EncryptExecutor().Client(this).Execute<EncryptResponse, EncryptResult, EncryptRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  启用当前状态为&#x60;已禁用&#x60;的密钥
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public EnableKeyResponse EnableKey(EnableKeyRequest request) {
            return  new EnableKeyExecutor().Client(this).Execute<EnableKeyResponse, EnableKeyResult, EnableKeyRequest>(request);
        }
#else
        /// <summary>
        ///  启用当前状态为&#x60;已禁用&#x60;的密钥
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<EnableKeyResponse> EnableKey(EnableKeyRequest request) {
            return await new EnableKeyExecutor().Client(this).Execute<EnableKeyResponse, EnableKeyResult, EnableKeyRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  取消删除密钥
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public CancelKeyDeletionResponse CancelKeyDeletion(CancelKeyDeletionRequest request) {
            return  new CancelKeyDeletionExecutor().Client(this).Execute<CancelKeyDeletionResponse, CancelKeyDeletionResult, CancelKeyDeletionRequest>(request);
        }
#else
        /// <summary>
        ///  取消删除密钥
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<CancelKeyDeletionResponse> CancelKeyDeletion(CancelKeyDeletionRequest request) {
            return await new CancelKeyDeletionExecutor().Client(this).Execute<CancelKeyDeletionResponse, CancelKeyDeletionResult, CancelKeyDeletionRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  删除机密
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DeleteSecretResponse DeleteSecret(DeleteSecretRequest request) {
            return  new DeleteSecretExecutor().Client(this).Execute<DeleteSecretResponse, DeleteSecretResult, DeleteSecretRequest>(request);
        }
#else
        /// <summary>
        ///  删除机密
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DeleteSecretResponse> DeleteSecret(DeleteSecretRequest request) {
            return await new DeleteSecretExecutor().Client(this).Execute<DeleteSecretResponse, DeleteSecretResult, DeleteSecretRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  禁用机密
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DisableSecretResponse DisableSecret(DisableSecretRequest request) {
            return  new DisableSecretExecutor().Client(this).Execute<DisableSecretResponse, DisableSecretResult, DisableSecretRequest>(request);
        }
#else
        /// <summary>
        ///  禁用机密
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DisableSecretResponse> DisableSecret(DisableSecretRequest request) {
            return await new DisableSecretExecutor().Client(this).Execute<DisableSecretResponse, DisableSecretResult, DisableSecretRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  禁用指定版本机密
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DisableSecretVersionResponse DisableSecretVersion(DisableSecretVersionRequest request) {
            return  new DisableSecretVersionExecutor().Client(this).Execute<DisableSecretVersionResponse, DisableSecretVersionResult, DisableSecretVersionRequest>(request);
        }
#else
        /// <summary>
        ///  禁用指定版本机密
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DisableSecretVersionResponse> DisableSecretVersion(DisableSecretVersionRequest request) {
            return await new DisableSecretVersionExecutor().Client(this).Execute<DisableSecretVersionResponse, DisableSecretVersionResult, DisableSecretVersionRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  创建一个CMK（用户主密钥），默认为启用状态
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public CreateKeyResponse CreateKey(CreateKeyRequest request) {
            return  new CreateKeyExecutor().Client(this).Execute<CreateKeyResponse, CreateKeyResult, CreateKeyRequest>(request);
        }
#else
        /// <summary>
        ///  创建一个CMK（用户主密钥），默认为启用状态
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<CreateKeyResponse> CreateKey(CreateKeyRequest request) {
            return await new CreateKeyExecutor().Client(this).Execute<CreateKeyResponse, CreateKeyResult, CreateKeyRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  -   修改对称密钥配置，包括key的名称、用途、是否自动轮换和轮换周期等;
        /// -   修改非对称密钥配置，包括key的名称、用途等。
        /// 
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public UpdateKeyDescriptionResponse UpdateKeyDescription(UpdateKeyDescriptionRequest request) {
            return  new UpdateKeyDescriptionExecutor().Client(this).Execute<UpdateKeyDescriptionResponse, UpdateKeyDescriptionResult, UpdateKeyDescriptionRequest>(request);
        }
#else
        /// <summary>
        ///  -   修改对称密钥配置，包括key的名称、用途、是否自动轮换和轮换周期等;
        /// -   修改非对称密钥配置，包括key的名称、用途等。
        /// 
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<UpdateKeyDescriptionResponse> UpdateKeyDescription(UpdateKeyDescriptionRequest request) {
            return await new UpdateKeyDescriptionExecutor().Client(this).Execute<UpdateKeyDescriptionResponse, UpdateKeyDescriptionResult, UpdateKeyDescriptionRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  使用非对称密钥的私钥签名,签名算法仅支持RSA_PKCS1_PADDING填充方式,最大签名数据长度为4K字节
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public SignResponse Sign(SignRequest request) {
            return  new SignExecutor().Client(this).Execute<SignResponse, SignResult, SignRequest>(request);
        }
#else
        /// <summary>
        ///  使用非对称密钥的私钥签名,签名算法仅支持RSA_PKCS1_PADDING填充方式,最大签名数据长度为4K字节
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<SignResponse> Sign(SignRequest request) {
            return await new SignExecutor().Client(this).Execute<SignResponse, SignResult, SignRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  获取机密详情
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DescribeSecretVersionListResponse DescribeSecretVersionList(DescribeSecretVersionListRequest request) {
            return  new DescribeSecretVersionListExecutor().Client(this).Execute<DescribeSecretVersionListResponse, DescribeSecretVersionListResult, DescribeSecretVersionListRequest>(request);
        }
#else
        /// <summary>
        ///  获取机密详情
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DescribeSecretVersionListResponse> DescribeSecretVersionList(DescribeSecretVersionListRequest request) {
            return await new DescribeSecretVersionListExecutor().Client(this).Execute<DescribeSecretVersionListResponse, DescribeSecretVersionListResult, DescribeSecretVersionListRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  使用非对称密钥的公钥验证签名
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public ValidateResponse Validate(ValidateRequest request) {
            return  new ValidateExecutor().Client(this).Execute<ValidateResponse, ValidateResult, ValidateRequest>(request);
        }
#else
        /// <summary>
        ///  使用非对称密钥的公钥验证签名
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<ValidateResponse> Validate(ValidateRequest request) {
            return await new ValidateExecutor().Client(this).Execute<ValidateResponse, ValidateResult, ValidateRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  导出机密
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public ExportSecretResponse ExportSecret(ExportSecretRequest request) {
            return  new ExportSecretExecutor().Client(this).Execute<ExportSecretResponse, ExportSecretResult, ExportSecretRequest>(request);
        }
#else
        /// <summary>
        ///  导出机密
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<ExportSecretResponse> ExportSecret(ExportSecretRequest request) {
            return await new ExportSecretExecutor().Client(this).Execute<ExportSecretResponse, ExportSecretResult, ExportSecretRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  删除指定版本机密
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DeleteSecretVersionResponse DeleteSecretVersion(DeleteSecretVersionRequest request) {
            return  new DeleteSecretVersionExecutor().Client(this).Execute<DeleteSecretVersionResponse, DeleteSecretVersionResult, DeleteSecretVersionRequest>(request);
        }
#else
        /// <summary>
        ///  删除指定版本机密
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DeleteSecretVersionResponse> DeleteSecretVersion(DeleteSecretVersionRequest request) {
            return await new DeleteSecretVersionExecutor().Client(this).Execute<DeleteSecretVersionResponse, DeleteSecretVersionResult, DeleteSecretVersionRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  获取密钥详情
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DescribeKeyResponse DescribeKey(DescribeKeyRequest request) {
            return  new DescribeKeyExecutor().Client(this).Execute<DescribeKeyResponse, DescribeKeyResult, DescribeKeyRequest>(request);
        }
#else
        /// <summary>
        ///  获取密钥详情
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DescribeKeyResponse> DescribeKey(DescribeKeyRequest request) {
            return await new DescribeKeyExecutor().Client(this).Execute<DescribeKeyResponse, DescribeKeyResult, DescribeKeyRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  导入机密
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public ImportSecretResponse ImportSecret(ImportSecretRequest request) {
            return  new ImportSecretExecutor().Client(this).Execute<ImportSecretResponse, ImportSecretResult, ImportSecretRequest>(request);
        }
#else
        /// <summary>
        ///  导入机密
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<ImportSecretResponse> ImportSecret(ImportSecretRequest request) {
            return await new ImportSecretExecutor().Client(this).Execute<ImportSecretResponse, ImportSecretResult, ImportSecretRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  计划在以后的是个时间点删除密钥，默认为7天
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public ScheduleKeyDeletionResponse ScheduleKeyDeletion(ScheduleKeyDeletionRequest request) {
            return  new ScheduleKeyDeletionExecutor().Client(this).Execute<ScheduleKeyDeletionResponse, ScheduleKeyDeletionResult, ScheduleKeyDeletionRequest>(request);
        }
#else
        /// <summary>
        ///  计划在以后的是个时间点删除密钥，默认为7天
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<ScheduleKeyDeletionResponse> ScheduleKeyDeletion(ScheduleKeyDeletionRequest request) {
            return await new ScheduleKeyDeletionExecutor().Client(this).Execute<ScheduleKeyDeletionResponse, ScheduleKeyDeletionResult, ScheduleKeyDeletionRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  立即轮换密钥，自动轮换周期顺延-支持对称密钥
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public KeyRotationResponse KeyRotation(KeyRotationRequest request) {
            return  new KeyRotationExecutor().Client(this).Execute<KeyRotationResponse, KeyRotationResult, KeyRotationRequest>(request);
        }
#else
        /// <summary>
        ///  立即轮换密钥，自动轮换周期顺延-支持对称密钥
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<KeyRotationResponse> KeyRotation(KeyRotationRequest request) {
            return await new KeyRotationExecutor().Client(this).Execute<KeyRotationResponse, KeyRotationResult, KeyRotationRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  获取机密列表
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DescribeSecretListResponse DescribeSecretList(DescribeSecretListRequest request) {
            return  new DescribeSecretListExecutor().Client(this).Execute<DescribeSecretListResponse, DescribeSecretListResult, DescribeSecretListRequest>(request);
        }
#else
        /// <summary>
        ///  获取机密列表
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DescribeSecretListResponse> DescribeSecretList(DescribeSecretListRequest request) {
            return await new DescribeSecretListExecutor().Client(this).Execute<DescribeSecretListResponse, DescribeSecretListResult, DescribeSecretListRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  获取指定机密版本的详细信息
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DescribeSecretVersionInfoResponse DescribeSecretVersionInfo(DescribeSecretVersionInfoRequest request) {
            return  new DescribeSecretVersionInfoExecutor().Client(this).Execute<DescribeSecretVersionInfoResponse, DescribeSecretVersionInfoResult, DescribeSecretVersionInfoRequest>(request);
        }
#else
        /// <summary>
        ///  获取指定机密版本的详细信息
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DescribeSecretVersionInfoResponse> DescribeSecretVersionInfo(DescribeSecretVersionInfoRequest request) {
            return await new DescribeSecretVersionInfoExecutor().Client(this).Execute<DescribeSecretVersionInfoResponse, DescribeSecretVersionInfoResult, DescribeSecretVersionInfoRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  禁用指定版本密钥
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DisableKeyVersionResponse DisableKeyVersion(DisableKeyVersionRequest request) {
            return  new DisableKeyVersionExecutor().Client(this).Execute<DisableKeyVersionResponse, DisableKeyVersionResult, DisableKeyVersionRequest>(request);
        }
#else
        /// <summary>
        ///  禁用指定版本密钥
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DisableKeyVersionResponse> DisableKeyVersion(DisableKeyVersionRequest request) {
            return await new DisableKeyVersionExecutor().Client(this).Execute<DisableKeyVersionResponse, DisableKeyVersionResult, DisableKeyVersionRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  使用密钥对数据进行解密，针对非对称密钥：使用私钥进行加密
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DecryptResponse Decrypt(DecryptRequest request) {
            return  new DecryptExecutor().Client(this).Execute<DecryptResponse, DecryptResult, DecryptRequest>(request);
        }
#else
        /// <summary>
        ///  使用密钥对数据进行解密，针对非对称密钥：使用私钥进行加密
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DecryptResponse> Decrypt(DecryptRequest request) {
            return await new DecryptExecutor().Client(this).Execute<DecryptResponse, DecryptResult, DecryptRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  启用机密
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public EnableSecretResponse EnableSecret(EnableSecretRequest request) {
            return  new EnableSecretExecutor().Client(this).Execute<EnableSecretResponse, EnableSecretResult, EnableSecretRequest>(request);
        }
#else
        /// <summary>
        ///  启用机密
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<EnableSecretResponse> EnableSecret(EnableSecretRequest request) {
            return await new EnableSecretExecutor().Client(this).Execute<EnableSecretResponse, EnableSecretResult, EnableSecretRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  禁用当前状态为&#x60;已启用&#x60;的密钥
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DisableKeyResponse DisableKey(DisableKeyRequest request) {
            return  new DisableKeyExecutor().Client(this).Execute<DisableKeyResponse, DisableKeyResult, DisableKeyRequest>(request);
        }
#else
        /// <summary>
        ///  禁用当前状态为&#x60;已启用&#x60;的密钥
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DisableKeyResponse> DisableKey(DisableKeyRequest request) {
            return await new DisableKeyExecutor().Client(this).Execute<DisableKeyResponse, DisableKeyResult, DisableKeyRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  启用指定版本机密
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public EnableSecretVersionResponse EnableSecretVersion(EnableSecretVersionRequest request) {
            return  new EnableSecretVersionExecutor().Client(this).Execute<EnableSecretVersionResponse, EnableSecretVersionResult, EnableSecretVersionRequest>(request);
        }
#else
        /// <summary>
        ///  启用指定版本机密
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<EnableSecretVersionResponse> EnableSecretVersion(EnableSecretVersionRequest request) {
            return await new EnableSecretVersionExecutor().Client(this).Execute<EnableSecretVersionResponse, EnableSecretVersionResult, EnableSecretVersionRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  计划在以后的是个时间点删除指定版本密钥，默认为7天
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public ScheduleKeyVersionDeletionResponse ScheduleKeyVersionDeletion(ScheduleKeyVersionDeletionRequest request) {
            return  new ScheduleKeyVersionDeletionExecutor().Client(this).Execute<ScheduleKeyVersionDeletionResponse, ScheduleKeyVersionDeletionResult, ScheduleKeyVersionDeletionRequest>(request);
        }
#else
        /// <summary>
        ///  计划在以后的是个时间点删除指定版本密钥，默认为7天
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<ScheduleKeyVersionDeletionResponse> ScheduleKeyVersionDeletion(ScheduleKeyVersionDeletionRequest request) {
            return await new ScheduleKeyVersionDeletionExecutor().Client(this).Execute<ScheduleKeyVersionDeletionResponse, ScheduleKeyVersionDeletionResult, ScheduleKeyVersionDeletionRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  获取版本详情
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public DescribeKeyDetailResponse DescribeKeyDetail(DescribeKeyDetailRequest request) {
            return  new DescribeKeyDetailExecutor().Client(this).Execute<DescribeKeyDetailResponse, DescribeKeyDetailResult, DescribeKeyDetailRequest>(request);
        }
#else
        /// <summary>
        ///  获取版本详情
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<DescribeKeyDetailResponse> DescribeKeyDetail(DescribeKeyDetailRequest request) {
            return await new DescribeKeyDetailExecutor().Client(this).Execute<DescribeKeyDetailResponse, DescribeKeyDetailResult, DescribeKeyDetailRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  创建机密新的版本，默认为已启用状态
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public CreateSecretVersionResponse CreateSecretVersion(CreateSecretVersionRequest request) {
            return  new CreateSecretVersionExecutor().Client(this).Execute<CreateSecretVersionResponse, CreateSecretVersionResult, CreateSecretVersionRequest>(request);
        }
#else
        /// <summary>
        ///  创建机密新的版本，默认为已启用状态
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<CreateSecretVersionResponse> CreateSecretVersion(CreateSecretVersionRequest request) {
            return await new CreateSecretVersionExecutor().Client(this).Execute<CreateSecretVersionResponse, CreateSecretVersionResult, CreateSecretVersionRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  修改机密描述
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public UpdateSecretResponse UpdateSecret(UpdateSecretRequest request) {
            return  new UpdateSecretExecutor().Client(this).Execute<UpdateSecretResponse, UpdateSecretResult, UpdateSecretRequest>(request);
        }
#else
        /// <summary>
        ///  修改机密描述
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<UpdateSecretResponse> UpdateSecret(UpdateSecretRequest request) {
            return await new UpdateSecretExecutor().Client(this).Execute<UpdateSecretResponse, UpdateSecretResult, UpdateSecretRequest>(request).ConfigureAwait(false);
        }
#endif
#if NET40||NET35
        /// <summary>
        ///  取消删除指定版本密钥
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public CancelKeyVersionDeletionResponse CancelKeyVersionDeletion(CancelKeyVersionDeletionRequest request) {
            return  new CancelKeyVersionDeletionExecutor().Client(this).Execute<CancelKeyVersionDeletionResponse, CancelKeyVersionDeletionResult, CancelKeyVersionDeletionRequest>(request);
        }
#else
        /// <summary>
        ///  取消删除指定版本密钥
        /// </summary>
        /// <param name="request">请求参数信息</param>
        /// <returns>请求结果信息</returns>
        public async Task<CancelKeyVersionDeletionResponse> CancelKeyVersionDeletion(CancelKeyVersionDeletionRequest request) {
            return await new CancelKeyVersionDeletionExecutor().Client(this).Execute<CancelKeyVersionDeletionResponse, CancelKeyVersionDeletionResult, CancelKeyVersionDeletionRequest>(request).ConfigureAwait(false);
        }
#endif

            /// <summary>
            ///  默认KmsClient 构造器 接口
            ///</summary>
            public interface Builder
            {

                /// <summary>
                /// 设置认证信息参数
                /// </summary>
                /// <param name="provider">认证信息提供对象</param>
                /// <returns>kmsClient 构造器</returns>
                Builder CredentialsProvider(CredentialsProvider provider);

                /// <summary>
                /// 设置请求环境参数
                /// </summary>
                /// <param name="environment">环境参数信息</param>
                /// <returns>kmsClient 构造器</returns>
                Builder Environment(Core.Client.SDKEnvironment environment);

                /// <summary>
                /// http 请求配置信息
                /// </summary>
                /// <param name="config">http 请求配置信息</param>
                /// <returns>kmsClient 构造器</returns>
                Builder HttpRequestConfig(HttpRequestConfig config);

                /// <summary>
                ///  构造KmsClient 对象
                ///</summary>
                KmsClient Build();
            }

            /// <summary>
            ///  默认KmsClient 构造器
            ///</summary>
            public class DefaultBuilder : Builder
            {
                /// <summary>
                ///  KmsClient service client
                /// </summary>
                private  KmsClient kmsClient;

                /// <summary>
                ///  默认KmsClient 构造器构造对象
                ///</summary>
                public DefaultBuilder()
                {
                    kmsClient = new KmsClient();
                }

                /// <summary>
                ///  构造KmsClient 对象
                ///</summary>
                public KmsClient Build()
                {
                    if (kmsClient.CredentialsProvider == null)
                    {
                        //if credentialsProvider not set, try load jdcloud global default  credentials provider
                        kmsClient.credentialsProvider = JdCloud.DefaultInstance.GetCredentialsProvider();
                        if (kmsClient.credentialsProvider == null)
                        {
                            throw new ArgumentNullException("KmsClient build error: jdcloud credentials provider not set");
                        }
                    }
                    if (kmsClient.HttpRequestConfig == null)
                    {
                        kmsClient.httpRequestConfig = JdCloud.DefaultInstance.GetHttpRequestConfig();
                        if (kmsClient.httpRequestConfig == null)
                        {
                        throw new ArgumentNullException("KmsClient build error: http request config not set");
                        }
                    }
                    return kmsClient;
                }

                /// <summary>
                /// 设置认证信息参数
                /// </summary>
                /// <param name="provider">认证信息提供对象</param>
                /// <returns>kmsClient 构造器</returns>
                public Builder CredentialsProvider(CredentialsProvider provider)
                {
                    kmsClient.credentialsProvider = provider;
                    return this;
                }

                /// <summary>
                /// 设置请求环境参数
                /// </summary>
                /// <param name="environment">环境参数信息</param>
                /// <returns>kmsClient 构造器</returns>
                public Builder Environment(SDKEnvironment environment)
                {
                    kmsClient.environment = environment;
                    return this;
                }

                /// <summary>
                /// http 请求配置信息
                /// </summary>
                /// <param name="config">http 请求配置信息</param>
                /// <returns>kmsClient 构造器</returns>
                public Builder HttpRequestConfig(HttpRequestConfig config)
                {
                    kmsClient.httpRequestConfig = config;
                    return this;
                }
            }
    }
}
